package com.ant.storage.service.impl;

import com.ant.storage.common.ResultCode;
import com.ant.storage.common.ResultVo;
import com.ant.storage.dto.InventoryDto;
import com.ant.storage.excel.InventoryCensusExecl;
import com.ant.storage.handler.AntException;
import com.ant.storage.mapper.CommodityMapper;
import com.ant.storage.mapper.InventoryLogMapper;
import com.ant.storage.mapper.InventoryMapper;
import com.ant.storage.pojo.*;
import com.ant.storage.mapper.CarInventoryMapper;
import com.ant.storage.service.ICarInventoryService;
import com.ant.storage.service.ICommodityService;
import com.ant.storage.service.IWarehouseService;
import com.ant.storage.vo.CommodityVo;
import com.ant.storage.vo.InventoryCensusVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.ServletContext;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author melon
 * @since 2024-01-03
 */
@Service
public class CarInventoryServiceImpl extends ServiceImpl<CarInventoryMapper, CarInventory> implements ICarInventoryService {


    @Autowired
    private IWarehouseService warehouseService;

    @Autowired
    private ICommodityService commodityService;

    @Autowired(required = false)
    CommodityMapper commodityMapper;

    @Autowired(required = false)
    InventoryMapper inventoryMapper;

    @Resource
    public InventoryLogMapper inventoryLogMapper;

    @Autowired
    public ServletContext servletContext;

    @Override
    public Map<String,Object> querylist(InventoryDto dto) {
        try {
            Map<String,Object> map=new HashMap<>();
            map.put("list",commodityMapper.selectCarList(dto));
            map.put("total",commodityMapper.selectCarCount(dto));
            return map;
        } catch (Exception e) {
            throw new AntException(ResultCode.BODY_NOT_MATCH);
        }
    }
}
